package com.project.internship.controller.info;

import com.project.internship.entity.Bases;
import com.project.internship.entity.resp.RespBean;
import com.project.internship.service.BasesService;
import com.project.internship.vo.BasesDeptVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/information/baseSelf")
public class InfoBaseSelfController {

    @Autowired
    BasesService basesService;

    @GetMapping("/")
    public List<BasesDeptVO> getBaseSelf() {
        return basesService.getBaseSelf();
    }

    @PutMapping("/")
    public RespBean updateBaseInfo(@RequestBody BasesDeptVO basesDeptVO) {
        if(basesService.updateBaseInfo(basesDeptVO) == 1) {
            return RespBean.ok("修改成功！");
        }
        return RespBean.error("修改失败！");
    }

}
